<%-- 
    Document   : userDetails
    Created on : 25.07.2009, 11:30:20
    Author     : Mario
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="serverStyles.css" />
        <jsp:useBean id="watcher" scope="application" class="de.stalinski.login.Watcher" />
        <title>JSP Page</title>
        <%
        String id = request.getParameter("id");
        String user = request.getParameter("user");
        String uid = request.getParameter("uid");
        if (!watcher.isInList(id) || watcher.timedOut(id)) {
            String ret = "<meta http-equiv=\"refresh\" content=\"0; URL=index.jsp\">";
            out.print(ret);
        %><script>location.replace('index.jsp')</script><%
        } else {
            watcher.updateTimeOut(id);
        }
        %>
         <script language="JavaScript">
            function generateLink(){
                var user = document.frm.user.value;
                var id = document.frm.id.value;
                var from=document.frm.FROM.value;
                var uid = document.frm.uid.value;
                var to=document.frm.TO.value;

                window.location =('overview.jsp?user='+user+'&uid='+uid+'&id='+id+'&from='+from+'&to='+to);
            }
        </script>
    </head>
    <body>
        <%
        java.util.Date today = new java.util.Date(System.currentTimeMillis());
        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");
        String from = df.format(today);
        String to = df.format(today);
        %>
        <div id="container">
            <div id="header">
                <jsp:include page="header.html"/>
            </div>
            <div id="leftBar">
                <form name="frm">
                    <input type="hidden" name="user" value="<%=user%>"/>
                    <input type="hidden" name="id" value="<%=id%>"/>
                    <input type="hidden" name="uid" value="<%=uid%>"/>
                    <table class="menuTable"><tbody>

                            <tr><td>Verbrauch</td></tr>

                            <tr>
                                <td>Von:&nbsp;</td>
                                <td><input type="text" name="FROM" value="<%=from%>" class="year"/></td>
                            </tr>
                            <tr>
                                <td>Bis:&nbsp;</td>
                                <td><input type="text" name="TO" value="<%=to%>"class="year"/></td>
                            </tr>
                            <tr>
                                <td><div class="menu"><a id="link" href="#" onClick="generateLink()" >Anzeigen</a>
                            </div></td></tr>
                            <tr><td><div class="menu"><a href="prices.jsp?user=<%=user%>&id=<%=id%>&uid=<%=uid%>">Lager</a></div></td></tr>
                            <tr><td><div class="menu"><a href="userDetails.jsp?user=<%=user%>&id=<%=id%>&uid=<%=uid%>">Benutzerdetails</a></div></td></tr>
                            <tr><td><div class="menu"><a href="logout.jsp?user=<%=user%>&id=<%=id%>&uid=<%=uid%>">Logout</a></div></td></tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <div id="content">

            </div>
            <div id="rightBar">
                <%
        String logout = watcher.getLogoutTime(id);
        out.print("Automatische Abmeldung bei Inaktivität:\n" + logout);
                %>
            </div>
            <div id="footer" >
                <jsp:include page="footer.html"/>
            </div>
        </div>
    </body>
</html>
